//
//  ChatListCell.swift
//  MyTest
//
//  Created by guanzhongwang on 2021/5/10.
//

import UIKit

class ChatListCell: UITableViewCell {
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        let headimage = BaseImageView()
        headimage.isCircular = true
        headimage.backgroundColor = UIColor.red
        contentView.addSubview(headimage)
        headimage.snp.makeConstraints({
            $0.left.top.equalTo(15)
            $0.width.height.equalTo(40).priority(.high)
            $0.bottom.equalToSuperview().inset(15)
        })
        let icon = BaseImageView()
        icon.setBorder()
        icon.isCircular = true
        icon.backgroundColor = .blue
        headimage.addSubview(icon)
        icon.snp.makeConstraints({
            $0.bottom.right.equalToSuperview()
            $0.width.height.equalToSuperview().dividedBy(3)
        })
        let titleLabel = UILabel()
        titleLabel.text = "西瓜大学"
        titleLabel.font = Font_Size_14
        titleLabel.textColor = B000_COLOR
        contentView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints({
            $0.top.equalTo(headimage)
            $0.left.equalTo(headimage.snp.right).offset(5)
        })
        let subLabel = UILabel()
        subLabel.text = "该消息不支持打开"
        subLabel.font = Font_Size_12
        subLabel.textColor = B999_TITLE_COLOR
        contentView.addSubview(subLabel)
        subLabel.snp.makeConstraints({
            $0.bottom.equalTo(headimage.snp.bottom)
            $0.left.equalTo(titleLabel)
        })
        
        let timeLabel = UILabel()
        timeLabel.textColor = B999_TITLE_COLOR
        timeLabel.text = "刚刚"
        timeLabel.font = Font_Size_10
        contentView.addSubview(timeLabel)
        timeLabel.snp.makeConstraints({
            $0.right.equalToSuperview().inset(15)
            $0.centerY.equalTo(titleLabel)
            $0.left.equalTo(titleLabel.snp.right).offset(10)
        })
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
